var express = require('express');
var router = express.Router();
const db = require('../sql')
const jwt = require('../utils/jwt')

// 注册
router.post('/',async  function(req, res, next) {
  // const sql = 'select * from user'
  // const data = await db.getData(sql);
  res.send({
    code:'1',
    data:'注册成功'
  });
});

router.get('/',async  function(req, res, next) {
  console.log(req.query)
  // const sql = 'select * from user'
  // const data = await db.getData(sql);
  res.send({
    code:1,
    data:'登录成功',
    token:jwt.sign({id:1})
  });
});
module.exports = router;
